﻿Public Class Chronik

    Private Sub Chronik_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim ChronikArray() As String = Split(My.Computer.FileSystem.ReadAllText(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\glumeX\chronik.ini"), vbCrLf)
        For i = ChronikArray.Length - 1 To 0 Step -1
            If Not ChronikArray(i) = "" Then
                ListBox1.Items.Add(ChronikArray(i))
            End If
        Next
    End Sub

    Private Sub ListBox1_DoubleClick(ByVal sender As Object, ByVal e As System.EventArgs) Handles ListBox1.DoubleClick
        If Not ListBox1.SelectedIndex = -1 Then
            Dim SplitArray() As String = Split(ListBox1.SelectedItem, " | ")
            Form1.NewTab("Lade...", SplitArray(SplitArray.Length - 1))
            Me.Close()
        End If
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If MsgBox("Möchtest du wirklich die Gesammte Chronik löschen?", MsgBoxStyle.YesNo) = MsgBoxResult.Yes Then
            My.Computer.FileSystem.WriteAllText(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\glumeX\chronik.ini", "", False)
            MsgBox("Das löschen der Chronik war erfolgreich", MsgBoxStyle.Information)
            Me.Close()
        End If
    End Sub
End Class